<?php

require_once __dir__.'/../common.php';

$image = imagecreatefromgif('worldmap.gif');
$image_p = imagecreatetruecolor(MINI_MAP_SIZE, MINI_MAP_SIZE);

imagecopyresized($image_p, $image, 0, 0, 0, 0,
	MINI_MAP_SIZE, MINI_MAP_SIZE, imagesx($image), imagesy($image));

$scale = MINI_MAP_SIZE/imagesx($image);
$result = sys::sql("select * from test_items");
if (!empty($result))
{
	$red = imagecolorallocate($image_p, 255, 0, 0); 
	foreach ($result as $v)
	{
		$x = $v['item_x']*$scale;
		$y = $v['item_y']*$scale;
		imagefilledrectangle($image_p, $x-1, $y-1, $x+1, $y+1, $red);
	}
}




header('Content-type: image/jpeg');
imagejpeg($image_p, null, 100);
